import request from "./request";
interface ResultType<T> {
  code: number;
  message: string;
  result: T;
}

interface LoginType {
  account: string;
  password: string;
}
interface LoginResponse {
  token: string;
  type: number;
  username: string;
}
export function Login(data:LoginType){
  return request<LoginResponse, ResultType<LoginResponse>>({
    url: '/login',
    method: 'post',
    data
  })
}

interface RegisterType{
  username: string;
  account: string;
  password: string;
  age: number;
  sex: string;
  type: number;
}
export function Register(data:RegisterType){
  return request<[], ResultType<[]>>({
    url: '/register',
    method: 'post',
    data,
  });
}
